package expriment3_bag;
import java.util.Random;
public class one {
    public static void main(String[] args) {
        Random random = new Random();
        int[] a = new int[10];
        System.out.println("产生的10个随机数如下：");
        for (int i=0;i<a.length;i++){
            int temp=random.nextInt(100)+1;
            a[i] = temp;
            System.out.printf(a[i]+"    ");
        }
        int k=0;
        for (int i=0;i<a.length;i++){
            if (a[i]>a[k]){
                k=i;
            }
        }
        System.out.println();
        System.out.println("该数组最大数为："+a[k]);
        System.out.println("其所在索引为："+k);
    }
}
